class  Hunter :
    def __init__(self, name, Hunter, life, attack_value, hit_rate, magic_value):    
        self.name = name    
        self.hunter_type = hunter_type    
        self.life = life                
        self.attack_value = attack_value
        self.hit_rate = hit_rate
        self.hunter_value = hunter_value
    def op_deal_with(self, op_num, attack_obj):
        if op_num == 1:
            self.attack(attack_obj)
        else:
            self.sleep()
    def attack(self, attack_obj):        
        if probability_judge(self.hit_rate):
            attack_obj.life -= self.attack_value
        else:
            print("%s猎人，小手一抖，雷击箭射歪了。" % self.name)
    def sleep(self):
        print("猎人开始装箭") 
class Soldier:
    def __init__(self, name, soldier_type, life, attack_value, step, distance):
        self.name = name
        self.soldier_type = soldier_type
        self.life = life
        self.attack_value = attack_value    
        self.step = step                    
        self.distance = distance                      
    def op_deal_with(self, op_num, attack_obj)    
        if op_num == 1:
            self.attack(attack_obj)
        else:
            self.sleep()
    def attack(self, attack_obj):        
        if probability_judge(self.hit_rate):
            attack_obj.life -= self.attack_value

from war_utils import 

game_is_running = True
rounds = 1

Hunter = {
    "name": "sova",
    "life": 150,
    "type": "雷击箭",
    "hit_rate": 0.7,
    "attack": 75,
}


soldier1 = {
    "name": "yoru",
    "life": 300,
    "step": 2,
    "type": "时空跳跃",
    "attack": 40,
    "distance": 8,
    "state": 1  # 1表示前进，0表示时空跳跃
}

print("游戏开始")
while game_is_running:
    print("---------第%i回合---------" % rounds)
    if hunter["life"] <= 0 or soldier1["life"] <= 0:
        game_is_running = False
        break
    print("法师的回合:")
    if hunter["life"] > 0 and probability_judge(hunter["hit_rate"]):
        if soldier1["state"] == 1:
            print(">>>>%s使用了%s，击中了%s，造成了%i点伤害" % (hunter["name"], hunter["type"], soldier1["name"], hunter["attack"]))
            soldier1["life"] -= hunter["attack"]
        else:
            print(">>>>%s使用了%s，击中了时空跳跃的%s，未能集中，造成了%i点伤害" % (hunter["name"], hunter["type"], soldier1["name"], 0*hunter["attack"]))
            soldier1["life"] -= 0*hunter["attack"]
    else:
        print(">>>>%s使用了%s，小手tm一抖" % (hunter["name"], hunter["type"]))

    print("\n战士的回合")
    print("您的剩余血量：%i" % soldier1["life"])
    if soldier1["distance"] <= 8:
        print(">>>>战士%s开了一枪造成了%i点伤害" % (soldier1["name"], soldier1["attack"]))
        hunter["life"] -= soldier1["attack"]
    else:
        soldier1["distance"] += soldier1["step"]
        print(">>>>战士%s时空跳跃离开，距离法师还有%i个单位" % (soldier1["name"], soldier1["distance"]))
    soldier1["state"] = int(input("请输入您下回合需要执行的操作，1表示前进，0表示时空跳跃:"))
    print("-------------此回合结束------------\n")

    rounds += 1


if hunter["life"] > 0:
    print("法师胜！")
else:
    print("战士胜！")


